home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 April: Mac OS SDK / Dev.CD Apr 96 SDK / Dev.CD Apr 96 SDK1.toast / Development Kits (Disc 1) / OpenDoc Development Framework / ODFDev / ODF / OS / FWGraphx / Include / FWBmpShp.h < prev    next >
Encoding:
Text File  |  1995-11-08  |  5.3 KB  |  177 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                FWBmpShp.h
  4. //    Release Version:    $ 1.0d11 $
  5. //
  6. //    Copyright:    © 1995 by Apple Computer, Inc., all rights reserved.
  7. //
  8. //========================================================================================
  9.  
  10. #ifndef FWBMPSHP_H
  11. #define FWBMPSHP_H
  12.  
  13. #ifndef FWBNDSHP_H
  14. #include "FWBndShp.h"
  15. #endif
  16.  
  17. #ifndef FWBITMAP_H
  18. #include "FWBitmap.h"
  19. #endif
  20.  
  21. #if FW_LIB_EXPORT_PRAGMAS
  22. #pragma lib_export on
  23. #endif
  24.  
  25. //========================================================================================
  26. //    Forward Declarations
  27. //========================================================================================
  28.  
  29. class FW_CLASS_ATTR FW_CGraphicContext;
  30.  
  31. //========================================================================================
  32. //    class FW_CBitmapShape
  33. //========================================================================================
  34.  
  35. class FW_CLASS_ATTR FW_CBitmapShape : public FW_CBoundedShape
  36. {
  37. public:
  38.     FW_DECLARE_CLASS
  39.  
  40. //----------------------------------------------------------------------------------------
  41. //    Constructors/Destructors
  42. //
  43. public:
  44.     FW_CBitmapShape(FW_PBitmap bitmap, const FW_CRect& dstRect);
  45.     FW_CBitmapShape(FW_PBitmap bitmap, const FW_CRect& srcRect, const FW_CRect& dstRect);
  46.  
  47.     FW_CBitmapShape(const FW_CBitmapShape& other);
  48.     FW_CBitmapShape(FW_CReadableStream& archive);
  49.  
  50.     virtual ~FW_CBitmapShape();
  51.     
  52. //----------------------------------------------------------------------------------------
  53. //    Operators
  54. //
  55. public:
  56.     FW_CBitmapShape& operator=(const FW_CBitmapShape& other);
  57.     
  58. //---------------------------------------------------------------------------------------
  59. //    Inherited API
  60. //
  61. public:
  62.     // ----- Rendering -----
  63.     virtual void             Render(FW_CGraphicContext& gc) const;
  64.     
  65.     // ----- Flatten -----
  66.     virtual void                Flatten(FW_CWritableStream& archive) const;
  67.  
  68. //---------------------------------------------------------------------------------------
  69. //    New API
  70. //
  71. public:
  72.     // ----- Rendering -----
  73.     static void            RenderBitmap(FW_CGraphicContext& gc,
  74.                                         FW_PBitmap bitmap,
  75.                                         const FW_CRect& srcRect,
  76.                                         const FW_CRect& dstRect,
  77.                                         const FW_PInk& ink = FW_kNormalInk);
  78.     static void            RenderBitmap(FW_CGraphicContext& gc,
  79.                                         FW_PBitmap bitmap,
  80.                                         const FW_CRect& dstRect,
  81.                                         const FW_PInk& ink = FW_kNormalInk);
  82.     
  83.     // ----- Copying -----
  84.     virtual FW_CShape*        Copy() const;
  85.                                     
  86.     // ----- Archiving -----
  87.     static void*             Read(FW_CReadableStream& archive);
  88.  
  89.     // ----- Geometry -----
  90.     void                    SetGeometry(const FW_PBitmap& bitmap, 
  91.                                 const FW_CRect& srcRect, 
  92.                                 const FW_CRect& dstRect);
  93.                                 
  94.     void                     GetGeometry(FW_PBitmap& bitmap, 
  95.                                 FW_CRect& srcRect, 
  96.                                 FW_CRect& dstRect) const;
  97.  
  98.     void                    SetSourceRect(const FW_CRect& srcRect);
  99.     void                    GetSourceRect(FW_CRect& srcRect) const;
  100.     
  101.     void                    SetDestinationRect(const FW_CRect& destinationRect);
  102.     void                    GetDestinationRect(FW_CRect& destinationRect) const;
  103.  
  104.     FW_PBitmap                 GetBitmap() const;    
  105.     void                     SetBitmap(const FW_PBitmap& bitmap);
  106.  
  107. //---------------------------------------------------------------------------------------
  108. //    Data Members
  109. //
  110. private:
  111.     FW_CRect            fSrcRect;
  112.     FW_PBitmap            fBitmap;
  113. };
  114.  
  115. //========================================================================================
  116. //    Inlines
  117. //========================================================================================
  118.  
  119. //---------------------------------------------------------------------------------------
  120. //    FW_CBitmapShape::SetSourceRect
  121. //---------------------------------------------------------------------------------------
  122.  
  123. inline void FW_CBitmapShape::SetSourceRect(const FW_CRect& srcRect)
  124. {
  125.     fSrcRect = srcRect;
  126. }
  127.  
  128. //---------------------------------------------------------------------------------------
  129. //    FW_CBitmapShape::GetSourceRect
  130. //---------------------------------------------------------------------------------------
  131.  
  132. inline void FW_CBitmapShape::GetSourceRect(FW_CRect& srcRect) const
  133. {
  134.     srcRect = fSrcRect;
  135. }
  136.  
  137. //---------------------------------------------------------------------------------------
  138. //    FW_CBitmapShape::GetDestinationRect
  139. //---------------------------------------------------------------------------------------
  140. inline void FW_CBitmapShape::GetDestinationRect(FW_CRect& dstRect) const
  141. {
  142.     dstRect = fRect;
  143. }
  144.  
  145. //---------------------------------------------------------------------------------------
  146. //    FW_CBitmapShape::SetDestinationRect
  147. //---------------------------------------------------------------------------------------
  148.  
  149. inline void FW_CBitmapShape::SetDestinationRect(const FW_CRect& dstRect)
  150. {
  151.     fRect = dstRect;
  152. }
  153.  
  154. //---------------------------------------------------------------------------------------
  155. //    FW_CBitmapShape::GetBitmap
  156. //---------------------------------------------------------------------------------------
  157.  
  158. inline FW_PBitmap FW_CBitmapShape::GetBitmap() const
  159. {
  160.     return fBitmap;
  161. }
  162.  
  163. //---------------------------------------------------------------------------------------
  164. //    FW_CBitmapShape::SetBitmap
  165. //---------------------------------------------------------------------------------------
  166.  
  167. inline void FW_CBitmapShape::SetBitmap(const FW_PBitmap& bitmap)
  168. {
  169.     fBitmap = bitmap;
  170. }
  171.  
  172. #if FW_LIB_EXPORT_PRAGMAS
  173. #pragma lib_export off
  174. #endif
  175.                 
  176. #endif
  177.